let fs = require('fs');
var config = require('./service.conf.json');
module.exports = config;

module.exports.httpsUri = "https://" + config.host + ":" + config.port;

if (!module.exports.https && module.exports.ssl) {
    try {
        let ssl = module.exports.ssl;
        let certPath = path.join(__dirname, ssl.cert);
        let keyPath = path.join(__dirname, ssl.key);
        console.info("certPath:" + certPath);
        console.info("keyPath:" + keyPath);
        module.exports.https = {
            cert: fs.readFileSync(certPath),
            key: fs.readFileSync(keyPath)
        };
    } catch (error) {
        console.log('failed to parse ssl');
    }
}
